package com.jiangnan.warehouse_management.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.sql.Timestamp;

@TableName("inventory")
@Data
public class Inventory {
    @TableId
    private Integer inventoryId;
    private Integer itemId;
    private Integer warehouseId;
    private Integer quantity;
    private Double unitPrice;

    @TableField(
            select = true,           // 查询时包含该字段
            insertStrategy = FieldStrategy.NEVER,  // 插入时忽略该字段
            updateStrategy = FieldStrategy.NEVER   // 更新时忽略该字段
    )
    private Double totalValue;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT_UPDATE) // 插入和更新时都填充
    private Timestamp lastCheckTime;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT) // 仅插入时填充
    private Timestamp createdAt;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT_UPDATE) // 插入和更新时都填充
    private Timestamp updatedAt;
}